﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;

namespace Myproject.CS
{
    public class MenuCS
    {

        public static string GetIndexMenu(string UserID)
        {
            string MenuString = string.Empty;
            MenuString += GetGroupMenu(UserID, "1", "161");
            MenuString += GetGroupMenu(UserID, "2", "162");
            MenuString += GetGroupMenu(UserID, "3", "163");
            MenuString += GetGroupMenu(UserID, "4", "165");
            MenuString += GetGroupMenu(UserID, "5", "166");
            return MenuString;
        }


        /// <summary>
        /// 
        /// </summary>
        /// <param name="UserID"></param>
        /// <param name="index">菜单组index</param>
        /// <param name="ParentIndex">伏羲菜单组index</param>
        /// <returns></returns>
        private static string GetGroupMenu(string UserID, string index, string ParentIndex)
        {
            try
            {
                //DataRow[] rows;
                //if (rows.Length > 0)
                //{
                //    Boolean tf = false;//判断整个菜单组是否显示
                //    int i = 1;//排序
                //    string menuhtml = "<li data-id=\"" + index + "\" data-pid=\"0\" data-faicon=\"table\">XXXXX</li>";
                //    foreach (DataRow r in rows)
                //    {
                //        if (Boolean.Parse(r["BrowseRight"].ToString()))
                //        {
                //            tf = true;
                //            menuhtml += "<li data-id=\"" + index + i.ToString() + "\" data-pid=\"" + index + "\" data-url=\"" + r["Url"].ToString() + "\" data-tabid=\"" + r["BjuiID"].ToString() + "\" data-faicon=\"" + r["BjuiIcon"].ToString() + "\">" + r["MenuName"].ToString() + "</li>";
                //            i++;
                //        }
                //    }
                //    if (tf)
                //    {
                //        return menuhtml;
                //    }
                //    else
                //    {
                //        return "";
                //    }
                //}
                //else
                //{
                    return "";
                //}
            }
            catch (Exception)
            {
                return "";
            }
        }
    }
}